package service

import (
	"context"

	v1 "hellorockscache/api/helloworld/v1"
	"hellorockscache/internal/biz"
)

// GreeterService is a greeter service.
type GreeterService struct {
	v1.UnimplementedGreeterServer

	uc *biz.GreeterUsecase
}

// NewGreeterService new a greeter service.
func NewGreeterService(uc *biz.GreeterUsecase) *GreeterService {
	return &GreeterService{uc: uc}
}

func (s *GreeterService) TestRocks(ctx context.Context, req *v1.TestRReq) (*v1.Ret, error) {
	return s.uc.TestRocks(ctx, req)
}

func (s *GreeterService) TestPipeline(ctx context.Context, req *v1.Empty) (*v1.Empty, error) {
	return s.uc.TestPipeline(ctx, req)
}

func (s *GreeterService) TestSetnx(ctx context.Context, req *v1.Empty) (*v1.Empty, error) {
	return s.uc.TestSetnx(ctx, req)
}

func (s *GreeterService) TestMultiCheck(ctx context.Context, req *v1.Empty) (*v1.Empty, error) {
	return s.uc.TestMultiCheck(ctx, req)
}

// 测试联合唯一索引冲突
func (s *GreeterService) TestBatchCreateUniqueIdx(ctx context.Context, req *v1.TestBatchCreateUniqueIdxReq) (*v1.Empty, error) {
	return s.uc.TestBatchCreateUniqueIdx(ctx, req)
}
